﻿using Microsoft.AspNetCore.Http;
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Application.Dtos;

namespace NewRetail.Application.Core
{
    public enum InOrOutEnum : int
    {
        IN = 1,
        OUT = 2
    }

    /// <summary>
    /// A-销售 B-退货 C-赠送
    /// </summary>
    public static class SalesTypes
    {
        public static string Sales => "A";
        public static string Refunds => "B";
        public static string Give => "C";
    }

    public static class MessageTopics
    {
        public const string PAY_DAY_SUM_CAL = "pay-day-sum-cal";
        public const string MEMBER_INTERGRAL_CAL = "member-intergral-cal";
        public const string DATA_SYNC = "data-sync";
        public const string WAREHOUSE_GOODS_COST_CAL = "warehouse-goods-cost-cal";
    }

    public class IdDto : EntityDto<string>
    {
        //
    }

    public class NoDto : EntityDto
    {
        public string no { get; set; }
    }

    public class ReceiptNoDto : EntityDto
    {
        public string receiptNo { get; set; }
        /// <summary>
        /// 显示类型，打印为"0"，空其他则为修改查看
        /// </summary>
        public string sType { get; set; }
    }

    public class ReceiptNoItemsDto<T> : ReceiptNoDto
    {
        public ReceiptNoItemsDto() { }
        public ReceiptNoItemsDto(T[] items)
        {
            this.Items = items;
        }

        public T[] Items { get; set; }

        public static implicit operator ReceiptNoItemsDto<T>(T[] items) => new ReceiptNoItemsDto<T>(items);
    }

    public class PagingRequestDto : EntityDto
    {
        public int Page { get; set; }
        public int PageSize { get; set; }
    }

    public class ProductPagingRequestDto : PagingRequestDto
    {
        public string warehouseId { get; set; }
        public string keyword { get; set; }
        public string name { get; set; }
        public string no { get; set; }
        public string categoryID { get; set; }
        public string supplierID { get; set; }
        public int InOrOut { get; set; }
        //显示类型。不传为全部显示，"1"为当天有销售的，"2"为当天未销售过的，"3"为从未销售过的
        public string showType { get; set; }
        //显示n天内没有销售过的记录,默认15天
        public int? noSaleDays { get; set; }
        //是否显示库存为0的产品,默认不显示
        public bool showZeroWarehouseGoodsNum { get; set; } = false;
        /// <summary>
        /// 开始日期
        /// </summary>
        public DateTime? beginDate { get; set; }
        /// <summary>
        /// 结束日期
        /// </summary>
        public DateTime? endDate { get; set; }
    }
    /// <summary>
    /// 综合查询颜色尺码使用
    /// </summary>
    public class ProductPagingColorSizeRequestDto : PagingRequestDto
    {
        public string warehouseId { get; set; }
        public string name { get; set; }
        public string goodsCode { get; set; }
        public string categoryID { get; set; }
        public string supplierID { get; set; }
        public int InOrOut { get; set; }
        //显示类型。不传为全部显示，"1"为当天有销售的，"2"为当天未销售过的，"3"为从未销售过的
        public string showType { get; set; }
        //显示n天内没有销售过的记录,默认15天
        public int? noSaleDays { get; set; }
        //是否显示库存为0的产品,默认不显示
        public bool showZeroWarehouseGoodsNum { get; set; } = false;
        /// <summary>
        /// 开始日期
        /// </summary>
        public DateTime? beginDate { get; set; }
        /// <summary>
        /// 结束日期
        /// </summary>
        public DateTime? endDate { get; set; }
    }

    public class WarehousePagingRequestDto : PagingRequestDto
    {
        public string name { get; set; }
        public string no { get; set; }
    }

    public class AdjustPricePagingDto : PagingRequestDto
    {
        public string receiptNo { get; set; }
        public string warehouseId { get; set; }
    }

    public class ChangeWarehousePagingDto : PagingRequestDto
    {
        public string inWarehouseId { get; set; }
        public string outWarehouseId { get; set; }
    }

    public class InOutWarehousePagingDto : PagingRequestDto
    {
        public string warehouseId { get; set; }
        public string supplierId { get; set; }
        public int? InOrOut { get; set; }
        public bool? isAuditing { get; set; }
        #region add by cl 2022.08.15
        public DateTime? startTime { get; set; }
        public DateTime? endTime { get; set; }
        #endregion
    }

    public class CheckStockPagingDto : PagingRequestDto
    {
        public string warehouseId { get; set; }
        public string receiptNo { get; set; }
        public DateTime? Date { get; set; }
    }

    public class SupplierPagingDto : PagingRequestDto
    {
        public string name { get; set; }
    }

    public class PaymentReceiptPagingDto : PagingRequestDto
    {
        public string receiptNo { get; set; }
        public DateTime? Date { get; set; }
    }

    #region 其他单分页查询输入 add by cl
    public class OtherBillPagingDto : PagingRequestDto
    {
        public string warehouseId { get; set; }
        public string receiptNo { get; set; }
        public DateTime? Date { get; set; }
    }
    #endregion

    public class GoodsChooseDto
    {
        public string warehouseId { get; set; }
        /// <summary>
        /// 选择商品的ID数组
        /// </summary>
        public string[] ids { get; set; }
    }

    public class AdvertisementPagingDto : PagingRequestDto
    {
        public string warehouseId { get; set; }
    }
    public class EnclosureDto
    {
        /// <summary>
        /// 附件类型（1：图片  2：文件）
        /// </summary>
        public int enclosureType { get; set; }
        /// <summary>
        /// 文件名
        /// </summary>
        public string fileName { get; set; }
        /// <summary>
        /// 原文件名
        /// </summary>
        public string origionName { get; set; }
        /// <summary>
        /// 附件Path
        /// </summary>
        public string ossPath { get; set; }
    }
    public class DefectiveBillPagingDto : PagingRequestDto
    {
        public string warehouseId { get; set; }
        public string receiptNo { get; set; }
        public string supplierId { get; set; }
        public DateTime? startTime { get; set; }
        public DateTime? endTime { get; set; }
        public bool? isAuditing { get; set; }
    }
    //add by cl 20230322
    /// <summary>
    /// 商品退货周期输入
    /// </summary>
    public class GoodsReturnCyclePagingDto : PagingRequestDto
    {
        public string categoryId { get; set; }
        public string supplierId { get; set; }
    }

    public class PrintAuthorizationCodeUpdateDto : EntityDto
    {
        public string warehouseId { get; set; }
    }

    public class GoodsMemberPricePagingDto : PagingRequestDto
    {
        /// <summary>
        /// 商品编码
        /// </summary>
        public string no { get; set; }
        /// <summary>
        /// 仓库编号
        /// </summary>
        public string warehouseId { get; set; }
    }

    public class PosPaymentTypePagingDto : PagingRequestDto
    {
        /// <summary>
        /// 付款方式代码
        /// </summary>
        public string payWay { get; set; }
    }
    public class UpdateGoodsIsNewProductStatusDto : IEntityDto
    {
        public string goodsId { get; set; }
        public bool? isNewProduct { get; set; }
    }

    public class QueryAllGoodsByWarehouseInputDto
    {
        public string warehouseId { get; set; }
    }

    /// <summary>
    /// 导入单品打折商品请求参数
    /// </summary>
    public class ImportDiscountGoodsReqDto
    {
        /// <summary>
        /// 附件
        /// </summary>
        [Required]
        public IFormFile Attachment { get; set; } = default!;
        /// <summary>
        /// 打折Id
        /// </summary>
        [Required]
        public string DiscountID { get; set; }
        /// <summary>
        /// 仓库Id
        /// </summary>
        [Required]
        public string warehouseID { get; set; }
    }
    /// <summary>
    /// 单品打折商品导入参数
    /// </summary>
    public class DiscountGoodsImportDto
    {
        /// <summary>
        /// 序号
        /// </summary>
        public int SeqNo { get; set; }
        /// <summary>
        /// 商品编码
        /// </summary>
        public string GoodsNo { get; set; }
    }
}
